import { Component, OnInit, Input } from '@angular/core';
import {Router} from '@angular/router'

@Component({
  selector: 'app-chart-zhengdong2',
  templateUrl: './chart-zhengdong2.component.html',
  styleUrls: ['./chart-zhengdong2.component.css']
})
export class ChartZhengdong2Component implements OnInit {

  constructor(
    private router:Router
  ) { }
  public chartOptions
  @Input() title:string;
  @Input() _data:any;

  ngOnInit() {
    let title = this.title;
  	this.chartOptions = {
      chart: {
        type: 'column'
      },
      title: {
        text: title,
        style: {
        	color: '#ed4227',
        	fontSize: '14px'
        },
        align: 'left',
        x: 5
      },
      xAxis: {
        categories: ['+X向', '+Y向'],
        tickLength: 0,
        //visible: false
      },
      plotOptions: {
        series: {
          borderWidth: 0,
          dataLabels: {
            enabled: true,
            format: '{point.y}'
          },
          cursor: 'pointer',
          point: {
            events: {
              click: e=>{
                this.router.navigate(['/pages/condition-monitoring/diagram-overview/2']);
              }
            }
          }
        }
      },
      tooltip:{
        enabled: false
      },
      yAxis: {
        title: '',
        gridLineColor: '#fff'
      },
      credits: {
        enabled: false
      },
      legend: {
        enabled: false
      },
      exporting: {
        enabled: false
      },
      series: [{
        name: '',
        data: this._data
      }]
    }
  }
}
